home *** CD-ROM | disk | FTP | other *** search
- //////////////////////////////
- //Host Script BitCom//
- //////////////////////////////popup
- declare STRING %s;
- declare STRING %a;
-
- declare STRING %cr;
- declare STRING %comma;
- declare int %tp;
- declare STRING %OK;
- declare STRING %space;
- declare STRING %swait;
- declare int %try;
-
- declare long %ret;
- declare STRING %sel;
- declare STRING %hosttime;
- declare STRING %logontime;
- declare STRING %logintime;
- declare STRING %logonfname;
- declare STRING %logonlname;
- declare STRING %logonpname;
-
- declare STRING %logonfile;
-
- declare STRING %file_name;
- declare STRING %file_time;
- declare STRING %file_size;
- declare STRING %terminated;
-
- declare long %count;
-
- // subroutine for displaying files in upload directory
- sub DISPLAYDIRECTORY
- %ret = FINDFIRST(%file_name, %file_time, %file_size)
- if (%ret != 1)
- {
- %s = "No files."
- TYPECR(%s)
- goto enddisp
- }
-
- TYPE(%file_name)
- TYPE(%space)
- TYPE(%file_size)
- TYPE(%space)
- TYPECR(%file_time)
-
- :findnextfile
- %ret = FINDNEXT(%file_name, %file_time, %file_size)
-
- if (%ret = 1)
- {
- TYPE(%file_name)
- TYPE(%space)
- TYPE(%file_size)
- TYPE(%space)
- TYPECR(%file_time)
-
- goto findnextfile
- }
- :enddisp
- endsub
-
- // subroutine for selecting file transfer protocol and file name
- sub SELECTFILEXFER
- :reselect
- TYPECR(%cr)
- TYPECR(%cr)
- %s = "Select file transfer protocol:"
- TYPECR(%s)
- %s = "<1> Xmodem <2> Xmodem 1K <3> Xmodem 1KG"
- TYPECR(%s)
- %s = "<4> Ymodem <5> YmodemG <6> Zmodem"
- TYPECR(%s)
- %s = "<7> Kermit <8> ASCII <9> Quit"
- TYPECR(%s)
-
- %s = "Your choice: "
- TYPE(%s)
-
- %sel = GETTYPE()
- %terminated = "TERMINATED"
- %ret = stricmp(%sel,%terminated)
- if (%ret = 0)
- {
- goto terminatedloop
- }
-
- if (%sel = "1")
- goto selfilename
-
- if (%sel = "2")
- goto selfilename
-
- if (%sel = "3")
- goto selfilename
-
- if (%sel = "4")
- goto selfilename
-
- if (%sel = "5")
- goto selfilename
-
- if (%sel = "6")
- goto selfilename
-
- if (%sel = "7")
- goto selfilename
-
- if (%sel = "8")
- goto selfilename
-
- if (%sel = "9")
- goto endsel
-
- goto reselect
-
- :selfilename
- TYPECR(%cr)
- %s = "Enter file name: "
- TYPE(%s)
- %file_name = GETTYPE()
- %terminated = "TERMINATED"
- %ret = stricmp(%file_name,%terminated)
- if (%ret = 0)
- {
- goto terminatedloop
- }
- TYPECR(%cr)
- %s = "Are you ready to start file transfer ? (Y/N) "
- TYPE(%s)
-
- %a = GETTYPE()
- %terminated = "TERMINATED"
- %ret = stricmp(%a,%terminated)
- if (%ret = 0)
- {
- goto terminatedloop
- }
- TYPECR(%cr)
-
- if (%a = "N" OR %a = "n")
- goto reselect
-
- :endsel
- endsub
-
- :START
-
- %cr = ""
- %comma = ","
- %space = " "
- %OK = "OK"
- %swait = "hello"
- %count = 0
- %try = 0
-
- TYPECR(%cr)
- TYPECR(%cr)
-
- :LOOP
-
- %s = "Entering Host Mode..."
- TYPECR(%s)
- %s = "sec"
- TWAIT(2, %s)
- AutoAnswerOn()
- %s = "sec"
- TWAIT(2, %s)
- %s = "Waiting for Logon."
- TYPECR(%s)
-
- WaitForOnline()
- CLEAR()
- POSCUR(1, 1)
-
- %s = "sec"
- TWAIT(2, %s)
-
- %s = "***********************************************"
- TYPECR(%s)
- %s = "* *"
- TYPECR(%s)
- %s = "* "
- TYPE(%s)
- %s = @Title
- TYPE(%s)
- %s = " *"
- TYPECR(%s)
- %s = "* *"
- TYPECR(%s)
- %s = "***********************************************"
- TYPECR(%s)
-
- TYPECR(%cr)
- TYPECR(%cr)
-
- :reenter
-
- %s = "Enter your first name:"
- TYPE(%s)
- %logonfname = GETTYPE()
- %terminated = "TERMINATED"
- %ret = stricmp(%logonfname,%terminated)
- if (%ret = 0)
- {
- goto terminatedloop
- }
- TYPECR(%cr)
-
- %s = "Enter your last name:"
- TYPE(%s)
- %logonlname = GETTYPE()
- %terminated = "TERMINATED"
- %ret = stricmp(%logonlname,%terminated)
- if (%ret = 0)
- {
- goto terminatedloop
- }
-
- if (@Password != "1")
- {
- %logintime = GETHOSTTIME()
- goto logontohost
- }
- %s = "Password:"
- TYPE(%s)
- %logonpname = GETTYPE()
- %terminated = "TERMINATED"
- %ret = stricmp(%logonpname,%terminated)
- if (%ret = 0)
- {
- goto terminatedloop
- }
- %ret = CheckUserEligibility(%logonfname, %logonlname, %logonpname)
- if (%ret = 1)
- {
- %s = "You have logged on to the BitCom Host."
- %logintime = GETHOSTTIME()
- goto logontohost
- }
-
- %try = %try + 1
-
- if (%try = 3)
- {
- %s = "Too many tries, Access denied."
- TYPECR(%s)
- goto end
- }
-
- %s = "Incorrect password, try again."
- TYPECR(%s)
- goto reenter
-
- :logontohost
-
- %count = %count + 1
- HostLogonMessage(%count, %logonfname, %logintime)
-
- :option
-
- TYPECR(%cr)
- TYPECR(%cr)
-
- %s = "Select items:"
- TYPECR(%cr)
- %s = "<F> File List <D> Download File <U> Upload File"
- TYPECR(%s)
- %s = "<T> Host Time <Q> Quit"
- TYPECR(%s)
-
- %s = "Your choice: "
- TYPE(%s)
-
- %a = GETTYPE()
- %terminated = "TERMINATED"
- %ret = stricmp(%a,%terminated)
- if (%ret = 0)
- {
- goto terminatedloop
- }
- if (%a = "F" OR %a = "f")
- call DISPLAYDIRECTORY
-
- if (%a = "D" OR %a = "d")
- {
- call SELECTFILEXFER
- TYPECR(%sel)
- if (%sel != "9")
- SENDFILE(%file_name, %sel)
- }
-
- if (%a = "U" OR %a = "u")
- {
- call SELECTFILEXFER
- TYPECR(%sel)
- if (%sel != "9")
- RECVFILE(%file_name, %sel)
- }
-
- if (%a = "T" OR %a = "t")
- {
- %hosttime = GETHOSTTIME()
- TYPECR(%cr)
- TYPECR(%cr)
- %s = "Login time: "
- TYPE(%s)
- TYPECR(%logintime)
- %s = "It is now: "
- TYPE(%s)
- TYPECR(%hosttime)
- }
-
- if (%a = "Q" OR %a = "q")
- goto end
-
- goto option
-
- :end
-
- TYPECR(%cr)
- TYPECR(%cr)
- %s = "Login time: "
- TYPE(%s)
- TYPECR(%logintime)
- %s = "Logoff time: "
- TYPE(%s)
- //The above 2 lines of the script Passes in a string "Logoff time"
- //This would set a flag in the code which would update the Host Mode stats
- //Do not change the sequence of the above 2 and below 2 line
- %hosttime = GETHOSTTIME()
- TYPECR(%hosttime)
- TYPECR(%cr)
- TYPECR(%cr)
- %s = "Thank you for visiting BitCom Host."
- TYPECR(%s)
-
- :terminatedloop
-
- HANGUP()
- WaitForOffline()
-
- %ret = fopen("Host.Log", "a")
- if (%ret = 1)
- {
- fputs(%logonfname, "Host.Log")
- fputs(%comma, "Host.Log")
- fputs(%logintime, "Host.Log")
- fputs(%comma, "Host.Log")
- fputs(%hosttime, "Host.Log")
- %tp = 10
- fputc(%tp, "Host.Log")
- fclose("Host.Log")
- }
- goto LOOP
- exit(0)
-